package com.guang.springbootrequestversion.controller;

import com.guang.springbootrequestversion.annotate.ApiVersion;
import com.guang.springbootrequestversion.bean.User;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;


@Slf4j
@RestController
@RequestMapping("api/{version}")
public class TestControllerV1 {

    @ApiVersion(1)
    @GetMapping("test")
    public void v1(){
        log.error("v1 的 test方法!!");
    }

    @ApiVersion(2)
    @GetMapping("test")
    public void v2(){
        log.error("v2 的 test方法!!");
    }

    @ApiVersion(3)
    @GetMapping("test")
    public void v3(){
        log.error("v3 的 test方法!!");
    }

    @ApiVersion(4)
    // @GetMapping("test")
    public User v4(){
        log.error("v4 的 test方法!!");
        return new User(1,"lig");
    }
}
